package com.dang.entity;
import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

/**
 * 用户实体类 
 * @author 但劲松
 *
 */
//hibernate 注解这是一个实体（有对应的表的）类
//table  映射对应的表
@Entity
@Table(name="t_user")
public class User implements Serializable{
	
	/**
	 * 统一采用 1L 序列化
	 */
	private static final long serialVersionUID = 1L;
	private int  id;											//主键
	private String trueName;									//真实姓名				
	private String userName;									//用户名
	private String password;									//密码
	private String sex;											//性别			
	private Date birthday;										//生日
	private String dentityCode;									//身份证号码	֤
	private String email;										//邮箱	
	private String mobile;										//电话
	private String address;										//地址	
	private int status=1;										//权限 普通用户为1
	
	
	/*
	 * 
		private List<Order> orderList = new LinkedList<Order>();
	 */
	
	
	@Id
	@GeneratedValue(generator="_native")						//主键策略
	@GenericGenerator(name="_native",strategy="native")			//采用native
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	
	@Column(length=20)
	public String getTrueName() {
		return trueName;
	}
	public void setTrueName(String trueName) {
		this.trueName = trueName;
	}
	
	@Column(length=20)
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	
	@Column(length=20)
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	
	@Column(length=5)
	public String getSex() {
		return sex;
	}
	public void setSex(String sex) {
		this.sex = sex;
	}
	
	public Date getBirthday() {
		return birthday;
	}
	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}
	
	@Column(length=20)
	public String getDentityCode() {
		return dentityCode;
	}
	public void setDentityCode(String dentityCode) {
		this.dentityCode = dentityCode;
	}
	
	@Column(length=20)
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	
	@Column(length=20)
	public String getMobile() {
		return mobile;
	}
	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	@Column(length=200)
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public int getStatus() {
		return status;
	}
	public void setStatus(int status) {
		this.status = status;
	}
	/*
		//允许级联删除(思考用户都不存在了要订单干嘛)
		@OneToMany(targetEntity=Order.class,cascade=CascadeType.ALL)
		@JoinColumn(name="userId",updatable=false)//外键 
		public List<Order> getOrderList() {
			return orderList;
		}
		public void setOrderList(List<Order> orderList) {
			this.orderList = orderList;
		}
	*/
	

}
